# Maintainer: Orhun Parmaksız <orhun@archlinux.org>
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=trippy
pkgver=0.7.0
pkgrel=1
pkgdesc='A network diagnostic tool'
arch=('loong64' 'x86_64')
url='https://trippy.cli.rs'
license=('Apache')
depends=('gcc-libs' 'libcap')
makedepends=('cargo')
install=$pkgname.install
source=("$pkgname-$pkgver.tar.gz::https://github.com/fujiapple852/trippy/archive/$pkgver.tar.gz")
b2sums=('f393b134f7e2cf2092c8c15d747a724624c58ea4fe42811b260aff0c0f3cead17d728677f089159ab0490602bb32d62fcddc400831cd0e0d95cc407b5af67436')

prepare() {
  cd $pkgname-$pkgver
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd $pkgname-$pkgver
  cargo build --release --frozen
}

check() {
  cd $pkgname-$pkgver
  cargo test --frozen
}

package() {
  cd $pkgname-$pkgver
  install -Dm 755 -t "$pkgdir"/usr/bin target/release/trip
  install -Dm 644 -t "$pkgdir"/usr/share/doc/"$pkgname" README.md
}
